<?php
namespace app\index\controller;

use app\index\model\CertModel;
use app\index\model\CertPersonModel;
use app\index\model\DeptModel;
use app\index\model\UserModel;
use think\Controller;

class Test extends Controller
{


    public function test(){
        $data = CertModel::field('id,chanid,personid')->where(['deleted_user'=>0])->select()->toArray();
        foreach ($data as $vvv){
            $personChanid = CertPersonModel::where(['id'=>$vvv['personid']])->value('chanid');
            CertModel::where(['id'=>$vvv['id']])->update(['chanid'=>$personChanid]);
        }


        dump('success');die;
    }



}
